<template>
<div>
    <div class="zhezhao" v-show="logoutShow"></div>
    <div class="div1" v-show="logoutShow" :style="logoutStyle">
        <div class="div2">下线通知</div>
        <div style="font-size: 14px;">您的密码已修改，请重新登陆。</div>
        <div class="div3" @click="gologin">确定</div>
    </div>
</div>
</template>

<script>
export default {
    name:'intercept_backspace',
    data(){
        return{
            logoutShow:0,
            logoutStyle:'',
            username:'',
        }
    },
    mounted(){
        if(this.$route.params.username != null){
            this.username=this.$route.params.username
        }
        if(this.$route.params.changepsw == 'success'){
            this.logoutShow=1
        }
    },
    methods:{
        gologin(){this.$router.push({name:'login',params:{'username':this.username}})},
    },
    // padding-top: 10px;
    // padding-bottom: 10px;
    // margin-left: 55px;
    // margin-right: 55px;
    watch:{
        logoutShow(value){
            if(value == 1){
                let num = 0
                let ok = 0
                var id = setInterval(() => {
                    this.logoutStyle='padding-top:'+num*0.5+'px;padding-bottom:'+num*0.5+'px;margin-left:'+(55-num)+'px;margin-right:'+(55-num)+'px'
                    if(num >=15){
                        ok = 1
                        num --
                    }else if(ok){
                        if(num <= 5){
                            clearInterval(id);
                        }else{
                            num--
                        }
                    }else{
                        num++
                    }
                    // console.log(this.logoutStyle);
                }, 12);
            }
        }
    }
}
</script>

<style scoped>
.zhezhao{
    width: 100%;
    height: 100%;
    background-color: black;
    opacity: 0.4;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
}
.div1{
    text-align: center;
    margin-top: 100px;
    margin-left: 55px;
    margin-right: 55px;
    user-select: none;
    background-color: rgb(255, 255, 255);
    position: relative;
    z-index: 3;
}
.div2{
    padding-top: 20px;
    padding-bottom: 10px;
    font-size: 16px;
}
.div3{
    margin-top: 15px;
    border-top: 0.7px solid rgb(215, 215, 215, 0.7);
    padding-top: 10px;
    padding-bottom: 10px;
    cursor: pointer;
}
</style>